<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		
		<meta charset="utf-8" />
		<title></title>
		
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="css/bootstrap.min.css" rel="stylesheet" />
		<link href="css/bootstrap-responsive.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/font-awesome.min.css" />
		<!--[if IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css" /><![endif]-->
		<!--[if lt IE 9]><link rel="stylesheet" href="css/ace-ie.min.css" /><![endif]-->
		<!-- 下拉框 -->
		<link rel="stylesheet" href="css/chosen.css" />
		
		<link rel="stylesheet" href="css/ace.min.css" />
		<link rel="stylesheet" href="css/ace-responsive.min.css" />
		<link rel="stylesheet" href="css/ace-skins.min.css" />
		
		<link rel="stylesheet" href="css/datepicker.css" /><!-- 日期框 -->
		<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="js/jquery.tips.js"></script>
		
	<script type="text/javascript">
	
	//保存
	function save(){
		
		if($("#UNMBER").val()==""){
			$("#UNMBER").tips({
				side:3,
	            msg:'请输入作品ID',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#UNMBER").focus();
			return false;
		}
		if($("#TITLE").val()==""){
			$("#TITLE").tips({
				side:3,
	            msg:'请输入作品标题',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#TITLE").focus();
			return false;
		}
		if($("#USERNAME").val()==""){
			$("#USERNAME").tips({
				side:3,
	            msg:'请输入作者',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#USERNAME").focus();
			return false;
		}
		if($("#TYPE").val()==""){
			$("#TYPE").tips({
				side:3,
	            msg:'请输入类型',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#TYPE").focus();
			return false;
		}
		if($("#UPLOAD").val()==""){
			$("#UPLOAD").tips({
				side:3,
	            msg:'请输入上传时间',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#UPLOAD").focus();
			return false;
		}
		if($("#TIME").val()==""){
			$("#TIME").tips({
				side:3,
	            msg:'请输入播放次数',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#TIME").focus();
			return false;
		}
		if($("#INTRO").val()==""){
			$("#INTRO").tips({
				side:3,
	            msg:'请输入作品简介',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#INTRO").focus();
			return false;
		}
		if($("#FUNMBER").val()==""){
			$("#FUNMBER").tips({
				side:3,
	            msg:'请输入分享次数',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#FUNMBER").focus();
			return false;
		}
		if($("#THHP").val()==""){
			$("#THHP").tips({
				side:3,
	            msg:'请输入推荐链接',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#THHP").focus();
			return false;
		}
		$("#Form").submit();
		$("#zhongxin").hide();
		$("#zhongxin2").show();
	}
	
</script>
	</head>
<body>
	<form action="production/${msg }.do" name="Form" id="Form" method="post">
		<input type="hidden" name="PRODUCTION_ID" id="PRODUCTION_ID" value="${pd.PRODUCTION_ID}"/>
		<div id="zhongxin">
		<table>
			<tr>
				<td><input type="text" name="UNMBER" id="UNMBER" value="${pd.UNMBER}" maxlength="32" placeholder="这里输入作品ID" title="作品ID"/></td>
			</tr>
			<tr>
				<td><input type="text" name="TITLE" id="TITLE" value="${pd.TITLE}" maxlength="32" placeholder="这里输入作品标题" title="作品标题"/></td>
				<td><input type="text" name="USERNAME" id="USERNAME" value="${pd.USERNAME}" maxlength="32" placeholder="这里输入作者" title="作者"/></td>
			</tr>
			<tr>
				<td><input type="text" name="TYPE" id="TYPE" value="${pd.TYPE}" maxlength="32" placeholder="这里输入类型" title="类型"/></td>
				<td><input class="span10 date-picker" name="UPLOAD" id="UPLOAD" value="${pd.UPLOAD}" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" placeholder="上传时间" title="上传时间"/></td>
			</tr>
			<tr>
				<td><input type="text" name="TIME" id="TIME" value="${pd.TIME}" maxlength="32" placeholder="这里输入播放次数" title="播放次数"/></td>
				<td><input type="text" name="INTRO" id="INTRO" value="${pd.INTRO}" maxlength="32" placeholder="这里输入作品简介" title="作品简介"/></td>
			</tr>
			<tr>
				<td><input type="number" name="FUNMBER" id="FUNMBER" value="${pd.FUNMBER}" maxlength="32" placeholder="这里输入分享次数" title="分享次数"/></td>
				<td><input type="text" name="THHP" id="THHP" value="${pd.THHP}" maxlength="32" placeholder="这里输入推荐链接" title="推荐链接"/></td>
			</tr>
			<tr>
				<td style="text-align: center;">
					<div class="photo">
						<img width="80%" src="<%=path %>/photo/${pd.COVERY}" />
					</div>
				</td>
				<td>
					<div>
						<input type="hidden" id="COVERY_TEXT" name="COVERY_TEXT" value="${pd.COVERY}"/>
						<input multiple type="file" id="COVERY" name="COVERY" />
					</div>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center;">
					<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
					<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
				</td>
			</tr>
		</table>
		</div>
		
		<div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>
		
	</form>
	
	
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script src="js/bootstrap.min.js"></script>
		<script src="js/ace-elements.min.js"></script>
		<script src="js/ace.min.js"></script>
		<script type="text/javascript" src="js/chosen.jquery.min.js"></script><!-- 下拉框 -->
		<script type="text/javascript" src="js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
		<script type="text/javascript">
		$(window.parent.hangge());
		$(function() {
			
			//单选框
			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			
			//日期框
			$('.date-picker').datepicker();
			
			$('#COVERY').ace_file_input({
				style:'well',
				btn_choose:'拖动或点击选择图片。。。',
				btn_change:null,
				no_icon:'icon-cloud-upload',
				droppable:true,
				onchange:null,
				thumbnail:'small',
				before_change:function(files, dropped) {
					/**
					if(files instanceof Array || (!!window.FileList && files instanceof FileList)) {
						//check each file and see if it is valid, if not return false or make a new array, add the valid files to it and return the array
						//note: if files have not been dropped, this does not change the internal value of the file input element, as it is set by the browser, and further file uploading and handling should be done via ajax, etc, otherwise all selected files will be sent to server
						//example:
						var result = []
						for(var i = 0; i < files.length; i++) {
							var file = files[i];
							if((/^image\//i).test(file.type) && file.size < 102400)
								result.push(file);
						}
						return result;
					}
					*/
					return true;
				}
				/*,
				before_remove : function() {
					return true;
				}*/
			}).on('change', function(){
				//console.log($(this).data('ace_input_files'));
				//console.log($(this).data('ace_input_method'));
			});
			
		});
		
		</script>
</body>
</html>